home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-23 | 19.9 KB | 404 lines | [TEXT/ttxt] |
- 2 The Environment
- The Macintosh Finder allows you to perform a series of
- operations by clicking and dragging icons and windows with
- your mouse, while MacDOS expects you to type commands on
- the keyboard.
-
- MacDOS does not normally display a cursor changing from a
- clock to an arrow to tell you when an operation has been
- completed. Instead, whenever MacDOS completes the execution
- of a command and is ready to accept the next one, it
- displays a prompting string at the beginning of the bottom
- line of the screen. That line is called Command Line. With
- commands affecting several files and folders at a time,
- MacDOS also displays the name of each item before it begins
- operating on it.
-
- A command is like an order in English: a verb in the
- imperative form, possibly followed by one or more objects
- and some qualifiers. Commands are usually case insensitive.
-
- The verb is called Command Name, the objects Parameters,
- and the qualifiers Switches or Options.
-
- After completing the typing of the command, you direct
- MacDOS to start its execution by pressing the RETURN key.
-
- Command Name
-
- The command name must be the first word of the command and
- is never case sensitive. Also, command names provided by
- MacDOS never contain spaces or other special characters.
-
- Parameters
- Most commands need one or more parameters to identify the
- objects they are requested to operate on. An example of
- commands which do not require any additional information is
- CLS, used to clear the MacDOS window.
-
- Many commands accept different numbers of parameters and
- automatically "fill in" the missing parameters with default
- values. For example, the command DIR displays lists of
- files in the MacDOS window and expects one parameter which
- identifies the files to be listed. Nevertheless, you can
- just type DIR without parameters to list the contents of
- the current folder.
-
- Parameters are sometimes case sensitive. For example, when
- you rename a file you have to type the new name exactly as
- you want it, with upper and lower case characters.
-
- The order of parameters is almost always fixed. For
- example, if you want to rename a file, you have to type the
- old name first and the new name second. A case in which the
- order is not important is when you copy several files with
- a single COPY command. In that case, you type the filenames
- one after the other separated by commata. MacDOS will copy
- the files in the order in which you specify them, but this
- should usually have no practical consequences.
-
- Switches
- Switches always start with a slash (the character '/').
- This is how MacDOS distinguishes them from parameters. The
- slash is always followed by a character which identifies
- the particular switch, and possibly other characters which
- select different ways of operation. For example, you obtain
- a sorted list of files by adding the switch /O to the
- command DIR. You can also specify ways of sorting by adding
- other characters to the switch: DIR/ODS displays a list of
- files sorted on the basis of their last upDate and Size
- (update first), while DIR/OSD lists the same files but
- giving priority to their size rather than the date and time
- of last update.
-
- As switches are always used to request optional features,
- they are never mandatory. Nevertheless, very often you will
- need to use one or more switches. For example, to avoid
- that a long list of files disappears off the top of the
- MacDOS window, you can type DIR/P instead of simply DIR.
-
- As with parameters, switches are seldom case sensitive. One
- case sensitive switch is /T, used to select a file-type.
- The 'T' of the switch can be in lower or upper case, but
- the file type must be correct: /t=TEXT is different from
- /t=TeXT because the two types 'TEXT' and 'TeXT' are seen as
- different by the Mac Operating System.
-
- The order and position of switches within a command are in
- most cases irrelevant. In fact, MacDOS extracts and
- analyses all the switches before looking at the parameters.
-
- One switch accepted by all commands is /?. When you type
- this switch in any position, MacDOS ignores all other
- parameters and switches and displays a brief description of
- the command.
-
- Redirection and Piping
- Most commands produce some output messages, either because
- that is their purpose, or because they provide information
- on their progress. For example, the purpose of the command
- DIR is precisely to produce a list of filenames. On the
- other hand, the COPY command lists the names of the files
- being copied.
-
- By default, MacDOS displays these messages in the MacDOS
- window but you can decide to re-direct them to a text file.
- To do so, you must add to the command a "greater than"
- character followed by the name of the text file. For
- example, DIR>MyFile lists the contents of the current
- folder in the text file MyFile rather than on the screen.
-
- When you redirect the output, MacDOS produces files which
- can be directly opened with any text editor or word
- processor.
-
- Note that error and warning messages are never redirected
- to files. MacDOS always displays them on the screen. Also,
- if you attempt to redirect the output of commands which
- have nothing to redirect, MacDOS displays a warning
- message, ignores the redirection, and executes the command
- as if you had not attempted a redirection.
-
- You can append the output of a command to an existing file,
- rather than create a new one, by typing two "greater than"
- signs instead of one (eg. DIR>>MyFile).
-
- The commands which accept output redirection are:
- ALARM, CALL, CD, CHDIR, CLOSE, CONFIRM, COPY, DATE, DIR,
- EJECT, EXIT, HELP, LOG, MD, MKDIR, MEM, MORE, NEXT,
- ONERROR, OPEN, PATH, PRINT, PROMPT, READ, RD, REM, REN,
- RENAME, RESTART, RMDIR, SERIAL, SHOW, SHUTDOWN, SUBSTVOL,
- TIME, TREE, TYPE, VER, VERIFY, VOL, WRITE, XCOPY .
-
- Some of these commands do not actually produce any output.
- Therefore, their acceptance of output redirection is simply
- an indication that they will not report a warning message
- if you do attempt to redirect their output.
-
- Beside redirecting the output produced by a command, you
- can also redirect the input from which the command MORE
- accepts data. You do this by appending to the command line
- a "less than" character followed by the name of the text
- file containing the data. This is useful in order to break
- down long displays into pages. For example, MORE<MyFile
- displays the text file MyFile one page at a time and
- prompts you to continue or interrupt the display at the end
- of each page.
-
- Input redirection is also possible with MacDOS extensions
- (ie. MacDOS filter applications). Please refer to the
- appropriate section for the details.
-
- Instead of redirecting the output of a command to a file
- and then use that file as input to MORE or to a filter
- application, you can combine the two commands and achieve
- the same result in a more efficient way. This mechanism is
- called piping. You just need to type the commands one after
- the other separated by a vertical bar (the character '|',
- called pipe). For example, if the on-line help displayed by
- the command COPY/? is too long to be contained in the
- MacDOS window, you can type COPY/?|MORE and MacDOS will
- wait for you at the end of each page.
-
- Pipes are only relevant for:
- • Internal commands which allow output redirection.
- • The command MORE (ie. the only internal command which
- accepts input redirection).
- • MacDOS filter applications.
-
- The command FOR is a special case, because it passes its
- output or input redirection to the command which follows
- the DO keyword. Therefore, although FOR itself does not
- accept redirection, a command line beginning with FOR can
- contain I/O redirection. Only single-line FORs accept I/O
- redirection. Moreover, input redirection and piping is only
- possible in conjuction with MORE .
-
- What follows is a complete list of the rules that govern
- redirection and piping in the MacDOS environment. In order
- to fully understand all its details, you will probably need
- to come back to this list after reading some other sections
- of this User's Guide.
- • In a single command, you can only redirect input and
- output once, and their order is irrelevant. If the line
- includes pipes, the input redirection applies to the
- first command and the output redirection to the last
- one, regardless of where the redirections actually
- appear within the line.
- • MacDOS displays a warning message whenever the user
- applies input or output redirection to a command that
- does not support it.
- • Most internal commands accept output redirection to
- file, but only MORE accepts input redirection. Single-
- line FORs accept input redirection when their DO is
- followed by MORE, in which case the redirection is
- considered to be referring to the MORE rather than to
- the FOR itself. Single-line FORs accept output
- redirection, but multi-line FORs don't.
- • Batch programs accept output redirection to file but not
- input redirection.
- • Applications and AppleScripts do not accept any I/O
- redirection.
- • MacDOS extensions accept both input and output
- redirections. Therefore, a chain of filters can obtain
- its input from a disk file rather than from a command.
- • MORE can only appear at the end of a command line (this
- includes the case in which there is nothing else and
- MORE is on its own).
- • A command line containing pipes can only begin with an
- internal command which supports output redirection (but
- excluding MORE), or with a filter. If it begins with a
- filter, the command line must include input redirection.
- • The command FOR only supports a pipe in the following
- case:
-
- FOR %var [/L] IN (set) DO internal-com-with-params |
- MORE
-
- That is, in the single-line format and with a single
- pipe used for MORE.
-
- Errors and Warnings
- MacDOS distinguishes between serious conditions which cause
- a command to be rejected or aborted (errors) and others
- which should not occur but can be tolerated (warnings).
-
- In any case, MacDOS displays a message to inform you that
- an abnormal condition has been detected.
-
- Most errors are due to the presence in a command of invalid
- parameters and switches, or the request to operate on
- something that does not exist.
-
- Warnings are usually caused by the attempt of redirecting
- I/O of a command which does not support redirection. You
- also get a warning when you attempt to use a DOS switch
- which is not supported by MacDOS.
-
- MacDOS normally reports errors and warnings by displaying a
- short message. You can use the ALARM ON command to have all
- error and warning conditions reported via an alert dialog
- box. MacDOS then pauses whenever it detects a problem and
- provides in the alert box some information which is not
- normally displayed.
-
- Refer to Appendix A for an indication of the possible
- causes of error and warning messages and some advice on
- possible remedies.
-
- Menus and Window
- The MacDOS window accepts commands and provides space for
- displaying command outputs. This is why throughout this
- manual it is also referred to as the console window. You
- can change the character size of the console window through
- the system variable FONTSIZE.
-
- MacDOS supports the standard mouse operations to work with
- text: cut, copy, paste, and clear. You can select text with
- the mouse and then select the appropriate item of the Edit
- menu or type the keyboard shortcut to perform the operation
- you need.
-
- This frees you from having to type long file and folder
- names, as you can copy names from a directory list and
- paste them into the command line. To make such an operation
- easier, MacDOS selects a whole quoted string (quote
- characters included) when you double click between a pair
- of matching quotes.
-
- Note that you cannot paste carriage return characters into
- the command line, because MacDOS interprets a carriage
- return as an order to execute a command.
-
- Typed characters are only accepted within the command line.
- If the selection is entirely outside the command line, the
- insertion point is moved to the end of the command line
- before showing the character typed. If, on the other hand,
- a selection covers part of a command, the selection is
- reduced to that part before replacing it with the character
- typed (ie. the left edge of the selection is moved to the
- first character of the command line).
-
- Only the command line can be altered. Therefore, outside of
- the command line:
- • "Cut Text" behaves like "Copy Text".
- • "Paste Text" moves to the end of the command line before
- pasting, effectively attaching the content of the
- clipboard to the end of the command.
- • "Clear Text" has no effect.
- If the selection includes a part of the command line, "Copy
- Text", "Paste Text", and "Clear Text" behave as if the
- selection only consisted of the part which is within the
- command line. That is, only the part of selection which is
- within the command line is cut, replaced, or cleared.
-
- Up and down arrows scroll through the previous and
- following commands. This possibility is particularly
- useful when you mistype a character of a long command,
- because you can "recall" the command by typing an up-arrow.
- You can then correct the mistake instead of having to
- retype the whole lot.
-
- Left and right arrows extend selections when they are
- shifted and move to the beginning and the end of the
- command line when they are pressed together with the option
- key.
-
- MacDOS also responds to the "Select cmd line" item of the
- Edit menu by highlighting and selecting whatever you have
- already typed after the current prompt. Similarly, "Select
- All" highlights the contents of the whole console window.
-
- The two items "Previous Cmd" and "Next Cmd" of the Edit
- menu (and their corresponding shortcuts cmd-dash and cmd-
- equal) behave like the up and down arrows.
-
- The console window accepts vertical scrolling and resizing
- via the standard vertical sidebar and boxes. The buffer is
- guaranteed to store at least the last 24000 characters
- typed or displayed.
-
- You can clear the console window with the command CLS
- (which stands for CLear Screen).
-
- To print the contents of the console window, select the
- "Print console..." item of the File menu or simply type the
- command PRINT . You can also set the format of the printed
- page by clicking on the item "Page Setup..." of the File
- menu.
-
- To close the console window and terminate MacDOS, you can:
- • Click on the "go away" box in the top left corner of the
- window.
- • Select either the Close or Quit item of the File menu.
- • Type cmd-Q.
- • Type the command EXIT .
-
- If you do not remember how to display MacDOS on-line help,
- select the "Help..." item of the apple menu. It will tell
- you how to use the command HELP .
-
- If some colleagues or friends would like to try MacDOS, you
- can create a demo version of MacDOS by selecting the "Make
- DEMO..." item of the File menu. MacDOS will then duplicate
- the MacDOS application file and disable the appropriate
- functionality.
-
- Control Codes
- You can abort the execution of most commands by typing cntl-
- C or cmd-dot. MacDOS achieves this by monitoring the
- keyboard at times when the current command can be safely
- interrupted.
-
- Two additional control codes are available: cntl-S and cntl-
- Q. They pause and resume long listings on the monitor
- screen. For example, instead of using the command MORE to
- list a text file one page at a time, you might choose to
- use the command TYPE and press cntl-S when you spot
- something which you want to read. You can then type cntl-Q
- to resume the listing or cntl-C to abort it.
-
- Tabbing
- You can use the TAB key to speed up the typing of long file
- and folder names and the shift-TAB key combination to enter
- frequently used strings.
-
- TAB
- When you press the TAB key, MacDOS interprets the preceding
- characters as a part of a file or folder name (with or
- without path) and attempts to complete it. To determine
- what portion of the command line to use, MacDOS examines
- the preceding characters in reversed order and stops when
- it finds a quote or a space.
-
- It then scans the current folder looking for matching names
- of files or subfolders:
- • If MacDOS does not find any match, it redisplays the
- command unchanged.
- • If MacDOS finds a single match, it completes the name
- within the command line and redisplays the command.
- • If MacDOS finds several matches, it lists them before
- redisplaying the command unchanged. In any case, MacDOS
- truncates the list of matches if it occupies more than
- half of the console window. If the matches have in
- common more characters than those typed by the user,
- MacDOS extends the partial name before redisplaying the
- command. This mechanism is particularly useful when
- navigating hierarchies of folders, because it lets you
- type the minimum number of characters needed to identify
- any particular item.
-
- Whenever MacDOS completes or extends a name and finds that
- the name was not quoted, it inserts the opening quote
- character.
-
- Shift-TAB
- When you type TAB while pressing the SHIFT key, MacDOS
- interprets the preceding characters as part of an
- abbreviation and attempts to replace it with a full string.
-
- For a description of this feature, please refer to the
- "Abbreviations" subsection of the "Customising MacDOS"
- section.
-
-